﻿using ChurchDiary.BLL;
using ChurchDiary.TableEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace FGPC.Controllers
{
    public class MagazineController : Controller
    {
        //
        // GET: /Magazine/

        public ActionResult Index()
        {
            //For Year link
            StringBuilder sbYearlink = new StringBuilder();
            for (int i = DateTime.Now.Year-3; i <= DateTime.Now.Year + 1; i++)
            {
                sbYearlink.Append("<li><a href='#' data-filter='." + i + "'>" + i + "</a></li>");
            }
            ViewBag.vbYearlink = sbYearlink.ToString();

            //For magazine
            List<EntityMagazine> Magazines = new BLL_Website().GetMagazhines();
            StringBuilder sbMagazine = new StringBuilder();
            foreach (EntityMagazine Magazine in Magazines)
            {
                sbMagazine.Append("<div class='col-md-3 col-sm-6 isotope-item " + Magazine.MagazineYear + "'>");
                sbMagazine.Append("<div class='image-box'>");
                sbMagazine.Append("<div class='overlay-container'>");
                sbMagazine.Append("<img src='http://admin.fgpc.in/uploads/Magazine/IndexImages/" + Magazine.MagazineStartImage + "' alt=''>");
                sbMagazine.Append("</div>");
                sbMagazine.Append("<div class='image-box-body'>");
                sbMagazine.Append("<h3 class='title'><a href='portfolio-item.html'>" + Magazine.MagazineHead + "</a></h3>");
                sbMagazine.Append("<p>" + Magazine.MagazineMonth + "/" + Magazine.MagazineYear + "</p>");
                sbMagazine.Append("<a target='_blank' href='http://admin.fgpc.in/uploads/Magazine/" + Magazine.MagazineFile + "' class='link'><span>Read More</span></a>");
                sbMagazine.Append("</div>");
                sbMagazine.Append("</div>");
                sbMagazine.Append("</div>");
            }
            ViewBag.vbMagazine = sbMagazine.ToString();

            ViewBag.Description = "We publish a monthly magazine – ‘Dharisanam’ – for the spiritual nourishment of people. We also print and publish spiritual books authored by eminent servants of God from our own organization.";
            ViewBag.Authur = "Full Gospel Pentecostal Church";
            return View();
        }
    }
}
